from ronglian_sms_sdk import SmsSDK
import random
import redis

accId = 'adasdadada'
accToken='adasdadadasdas'
appId ='dasdasdasddadasda'
def send_message(mobile):
    sdk = SmsSDK(accId,accToken,appId)
    tid = '1'
    code = random.randint(100000,999999)
    datas = (code,5)
    resp = sdk.sendMessage(tid,mobile,datas)
    cls = redis.Redis(host='127.0.0.1',port=6379,password='qjr041014')
    key = 'sms_%s'%mobile
    cls.set(key,code,ex=60*5)
    return resp